package com.rs.game.player.dialogues;

import com.rs.cache.loaders.NPCDefinitions;

public class StarSprite extends Dialogue {
	
/*
 * Author: Light 
 */
        private int npcId = 8091;
        

        @Override
        public void start() {
    		if (player.recievedGift == true) {
    			 sendEntityDialogue(SEND_2_TEXT_CHAT,
                         new String[] { NPCDefinitions.getNPCDefinitions(npcId).name,
                                         "eek la moon le fita, I have to go nowwww"}, IS_NPC, npcId, 9827);
    			end();
    		} else if (player.starSprite == false) {

    		} else {
   			 sendEntityDialogue(SEND_2_TEXT_CHAT,
                     new String[] { NPCDefinitions.getNPCDefinitions(npcId).name,
                                     "Greetings Earthling."}, IS_NPC, npcId, 9827);
    		}
        }
        
        @Override
        public void run(int interfaceId, int componentId) {
                if (stage == -1) {
                	sendPlayerDialogue(9827, "Ahhhh, What!? who are you!?!?");
                        stage = 1;
                } else if (stage == 1) {
                        	sendNPCDialogue(npcId, 9827, "Me called Star Sprite, I come to give you reward for freeeeing meee.");
                                stage = 2;
                } else if (stage == 2) {
                	sendPlayerDialogue(9827, "Whoaaa! What do I get?");
                	stage = 3;
                } else if (stage == 3) {
                	sendNPCDialogue(npcId, 9827, "You can have whatever is in my pocket... here you go.");
                	player.getInventory().addItem(989, 1);
                	player.getInventory().addItem(995, 250000);
                	player.recievedGift = true;
                	stage = 4;
                } else if (stage == 4) { 
                	sendPlayerDialogue(9827, "Whoaa Thanks alot!");
                	stage = 5;
                } else if (stage == 5) { 	
        			if (player.getInventory().containsItem(13727, 750)){
                      	sendNPCDialogue(npcId, 9827, "Wait wait wait, I see you Earthling are a true StarHunter! " +
        						"Would you like to exchange 750 StarDust for a Mighty Ring Of Wealth?");
        				stage = 6;
        			} else {
                      	sendNPCDialogue(npcId, 9827, "No problem, Earthling.");
        			}
                } else if (stage == 6) {
     				sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "Yes.", "No.");
     				stage = 7;
     			
                } else if (stage == 7) {
        			switch (componentId) {
                	case OPTION_1: 
            			if (player.getInventory().containsOneItem(13727, 750)){
            				player.getInventory().deleteItem(13727, 750);
            				player.getInventory().addItem(2572, 1);
                          	sendNPCDialogue(npcId, 9827, "Earthling, this ring provides great powers." +
            				"It will increase your chance on rare drop while worn!");
                          	stage = 8;
            			}
            		case OPTION_2:
            			end();
        	            player.getPackets().sendGameMessage("Come back when you collected at least 750 StarDust. The Star Sprite will reward you with extraterrestial treasures.");
            				}
                } else if (stage == 8) {
                	end();

                	}
                }


        @Override
        public void finish() {

        }
}